package cn.com.dhc.chesishan;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloForm extends HttpServlet {

	private static final long serialVersionUID = 669912851535799095L;

	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html");  //错将text写为txt的结果为:运行后下载未知程序
		
		PrintWriter out = response.getWriter();
		String docType = "<!doctype html public \"-//w3c//dtd html 4.0"
				+ "transitional//en\">\n";
		out.println(docType
				+ "<html>\n"
				+ "<body>\n"
				+ "<form action=\"http://localhost:8081/CssServletDemo/HelloForm2\" method=\"POST\">\n"
				+ "名字：\n" + "<input type=\"text\" name=\"first_name\">" + "</br>\n"
				+ "姓氏:\n" + "<input type=\"text\" name=\"last_name\" />\n"
				+ "\n" + "<input type=\"submit\" value=\"提交\" />\n"
				+ "</form></body></html>");
	}

	@Override
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

	}

}
